package modules

import "gorm.io/gorm"

type User struct {
	gorm.Model
	ID       int64  `gorm:"primaryKey"`
	UserID   int64  `gorm:"not null;uniqueIndex:idx_user_id"`
	Username string `gorm:"type:varchar(64);collation:utf8mb4_general_ci;not null;uniqueIndex:idx_username"`
	Password string `gorm:"type:varchar(64);collation:utf8mb4_general_ci;not null"`
	Email    string `gorm:"type:varchar(64);collation:utf8mb4_general_ci;not null"`
	Gender   int    `gorm:"type:tinyint(4);not null;default:0"`
}

func (User) TableName() string {
	return "user"
}

//db.Set("gorm:table_options", "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci").AutoMigrate(&User{})
//db.Model(&User{}).AddUniqueIndex("idx_user_id", "user_id")
//db.Model(&User{}).AddUniqueIndex("idx_username", "username")
